<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<body>
<b><p><iframe src="javascript:onunload = function() {
        if(!top.container) {
            top.container = document.createElement('div');
            top.container.appendChild(frameElement.parentNode);
        }
}"></iframe></b></p><!-- This order is intentional to force reparenting of iframe -->
<script>
description("Ensure that iframe onunload event handler triggered during reparenting that modifies the reparented DOM doesn't corrupt DOM.")
var iframe = document.querySelector("iframe");
shouldBe("iframe", "iframe.parentNode.firstChild");
var parentNode = iframe.parentNode;
shouldBe("parentNode", "parentNode.parentNode.firstChild");
</script>
</body>
